package pl.edu.agh.jemo.conf.types;

/**
 * Class designed to act as a bridge between Class objects and String representing their names.
 * It assigns String given by user, to certain Class, allowing to list class types in a user friendly way.
 * 
 * @author Marcin Zbijowski
 *
 * @param <T> Type of class stored by PrintableType
 */
public class PrintableType<T> { // dev: <T> needed? 
//	 dev: Map instead?
	
	/**
	 * Holds String representation of type.
	 */
	private String description;
	/**
	 * Stores Class of type associated with description.
	 */
	private Class<T> classType;
	
	/**
	 * Creates new PrintableType object with a given Class associated with given description.
	 * 
	 * @param classType	Class object to be associated with String
	 * @param description description to be printed as a String representation of object type
	 */
	public PrintableType(Class<T> classType, String description) {
		this.classType = classType;
		this.description = description;
	}
	
	/**
	 * Returns Class object stored in this object.
	 * 
	 * @return Class object represented by this object
	 */
	public Class<T> getClassType() {
		return classType;
	}
	
	/**
	 * Returns string representation combined with object.
	 * Method allows this objects to be stored in user interface elements, which refers to toString method
	 * 
	 *  @return String representation combined with object.
	 */
	@Override
	public String toString() {
		return description;
	}
}
